import request from '@/config/axios'

// 餐品-订餐记录 VO
export interface RecordVO {
  id: number // 编号
  foodId: number // 餐品id
  name: string // 名称
  type: string // 餐品类型
  price: number // 价格
  picture: string // 图片
  status: number // 状态，0已订餐，1已取餐，2用户取消，3系统取消
  orderDate: Date // 预定日期
  userId: number // 用户id
  userName: string // 用户昵称
  deptId: number // 部门id
  deptName: string // 部门名称
  orderDates: Date[] // 预定日期范围
}

// 餐品-订餐记录 API
export const RecordApi = {
  // 查询餐品-订餐记录分页
  getRecordPage: async (params: any) => {
    return await request.get({ url: `/ordering/record/page`, params })
  },

  // 查询订餐统计
  getTotalRecord: async (params: any) => {
    return await request.get({ url: `/ordering/record/getTotalRecord`, params })
  },
  

  // 查询餐品-订餐记录详情
  getRecord: async (id: number) => {
    return await request.get({ url: `/ordering/record/get?id=` + id })
  },

  // 新增餐品-订餐记录
  createRecord: async (data: RecordVO) => {
    return await request.post({ url: `/ordering/record/create`, data })
  },

  // 修改餐品-订餐记录
  updateRecord: async (data: RecordVO) => {
    return await request.put({ url: `/ordering/record/update`, data })
  },

  // 删除餐品-订餐记录
  deleteRecord: async (id: number) => {
    return await request.delete({ url: `/ordering/record/delete?id=` + id })
  },

  // 导出餐品-订餐记录 Excel
  exportRecord: async (params) => {
    return await request.download({ url: `/ordering/record/export-excel`, params })
  },

  
  // 批量送餐按钮操作
  sendBatch: async (data: RecordVO) => {
    return await request.post({ url: `/ordering/record/sendBatch`, data })
  },
  // 取消订餐
  cancel: async (data: RecordVO) => {
    return await request.post({ url: `/ordering/record/cancel`, data })
  },
  
}
